package net.csdn.business.notify.common.model.vo;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import net.csdn.business.notify.common.enums.ProcessStatusEnum;

import java.util.HashMap;
import java.util.Map;


/**
 * @ClassName SendResponseVO
 * @Description 发送接口返回值
 * @Author zhangyl
 * @Date 2023/11/29 11:32
 */
@Data
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class NotifyResponseVO {

    /**
     * 处理状态
     */
    private int status;

    /**
     * 处理信息
     */
    private String msg;

    /**
     * 处理失败的任务集合
     */
    private Map<String,String> fail=new HashMap<>();


    /**
     * @return 默认成功响应
     */
    public static NotifyResponseVO success() {
        return new NotifyResponseVO(ProcessStatusEnum.SUCCESS);
    }

   /* public static SendResponseVO success(ProcessStatusEnum status) {
        return new SendResponseVO(ProcessStatusEnum.SUCCESS);
    }*/

    public static NotifyResponseVO fail(ProcessStatusEnum status) {
        return new NotifyResponseVO(status);
    }


    public NotifyResponseVO(ProcessStatusEnum status) {
        this.status = status.getCode();
        this.msg = status.getMsg();
    }


    public void setStatus(ProcessStatusEnum status){
        this.status = status.getCode();
        this.msg = status.getMsg();
    }

}
